home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
Palettes
/
HotShape
/
HotShapeInspector.m
< prev
next >
Wrap
Text File
|
1995-06-12
|
3KB
|
96 lines
// HotShapeInspector.m
// By Charles G. Fleming, Educational Computing Services, Allegheny College.
// Copyright 1992 Allegheny College
// You may freely copy, distribute and reuse this code.
// Allegheny College and the author disclaim any warranty of any kind,
// expressed or implied, as to its fitness for any particular use.
// This work was partially supported by a grant from the Vira Heinz Endowment.
#import "HotShapeInspector.h"
#import "HotShape.h"
#define PATHS "ellipse rectangle diamond star triangle octagon"
@implementation HotShapeInspector
- init
{
NXBundle *bundle;
char path[MAXPATHLEN+1];
char *start, *token;
[super init];
// Load the inspector's nib file.
bundle = [NXBundle bundleForClass:[self class]];
[bundle getPath:path forResource:"HotShapeInspector" ofType:"nib"];
[NXApp loadNibFile:path owner:self withNames:NO fromZone:[self zone]];
start = PATHS;
token = strtok(start, "\n\t ");
while(token)
{
[[pathNamePopUpListButton target] addItem:token];
token = strtok(NULL, "\n\t ");
}
// Set the target and action for the popup list.
pathNamePopUpList = [pathNamePopUpListButton target];
[pathNamePopUpList setTarget:self];
[pathNamePopUpList setAction:@selector(ok:)];
return self;
}
- setPathNamePopUpListButton:anObject
{
pathNamePopUpListButton = anObject;
// Set the target and action for the popup list.
pathNamePopUpList = [pathNamePopUpListButton target];
[pathNamePopUpList setTarget:self];
[pathNamePopUpList setAction:@selector(ok:)];
[[pathNamePopUpList itemList] selectCellAt:0 :0];
return self;
}
// Get the names of the hot paths from the file HotPath.pws and add them
// to the popup list. Get the control's tag as well.
- revert:sender
{
// Display on the popup list button the hot path name.
[pathNamePopUpListButton setTitle:[object hotPathName]];
// Display the control's tag.
controlTag = [object tag];
[tagTextField setIntValue:controlTag];
// Display the visibility state.
[visibilitySwitch setState:[object visible]];
return [super revert:sender];
}
- ok:sender
{
const char *shapeName;
// Set the control's tag.
controlTag = [tagTextField intValue];
[object setTag:controlTag];
// Set the control's pathname.
shapeName = [[[pathNamePopUpList itemList] selectedCell] title];
[object setHotPathName:shapeName];
// Set the control's visibility.
[object setVisible:[visibilitySwitch state]];
[object display];
return [super ok:sender];
}
- (BOOL)wantsButtons
{
return NO;
}
@end